<template>
  <div class="addressedit">
        <!-- 顶部标签 -->
    <div class="top_biaoti">
      <van-nav-bar title="新建地址" left-arrow @click-left="onClickLeft"></van-nav-bar>
    </div>
      <van-address-edit
  show-postal
  show-set-default
  show-search-result
  :search-result="searchResult"
  :area-columns-placeholder="['请选择', '请选择', '请选择']"
  @save="onSave"
  @change-detail="onChangeDetail"
/>
  </div>
</template>

<script>
export default {
  data () {
    return {
      searchResult: []
    }
  },
  methods: {
    onClickLeft () {
      this.$router.push('/address')
    },
    onSave () {
      this.$router.push('/address')
    },
    onChangeDetail (val) {
      if (val) {
        this.searchResult = [{
          name: '黄龙万科中心',
          address: '杭州市西湖区'
        }]
      } else {
        this.searchResult = []
      }
    }
  }
}
</script>

<style scoped>
.van-nav-bar {
  background-color: #4990e0;
}
.van-nav-bar__title {
  color: #fff;
}
.van-nav-bar .van-icon{
  color: #fff;
}
.van-button--danger {
    color: #fff;
    background-color: #1989fa;
    border: 1px solid #1989fa;
}
</style>
